Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Defining a procedure to return Order Lines
This section discusses a procedure that retrieves the Order Lines from the database. This sample procedure is called
h-fetchOlines.p. It takes the current Order Number as anINPUTparameter. It then defines a temp-table with the fields from the OrderLine table plus the Item Name and the total Weight for the quantity ordered. Finally, it defines anOUTPUTparameter to return the set of Order Lines as a temp-table to the caller:
Notice that you must define the temp-table before you use it in a parameter definition.
Using the
INPUTparameter that passed in the Order Number, the code retrieves all the Order Lines for that Order. For each one, it creates a temp-table record.The procedure then needs to move all the OrderLine fields from the database record into the temp-table. In addition, it must copy the Item Name from the Item table and a calculation of the total weight for the Order Line based on the weight of the item and the quantity ordered.
You could do this with a long
ASSIGNstatement that names and assigns each field, but there’s a shorter way to do this, using theBUFFER-COPYstatement, as in this example:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |